package com.movie.ticket.sale.movieassembly.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.movie.ticket.sale.movieassembly.controller.form.*;
import com.movie.ticket.sale.movieassembly.controller.form.TMovie;
import com.movie.ticket.sale.movieassembly.mapper.MovieDetailsMapper;
import com.movie.ticket.sale.movieassembly.service.MovieDetailsService;
import com.movie.ticket.sale.moviecommon.model.*;
//import com.movie.ticket.sale.moviecommon.model.TMovie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MovieDetailsServiceImpl implements MovieDetailsService {
    @Autowired
    private MovieDetailsMapper movieDetailsMapper;

    private static final String USER_CACHE_NAME="user_cache";
    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public String getMovieData(int id) {
        return movieDetailsMapper.getMovieData(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id1")
    public TMovie getMovieInnformention(int id1) {
        //String str=movieDetailsMapper.getMovieInnformention(id).toString();
        return movieDetailsMapper.getMovieInnformention(id1);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public int getMovieReviewNumber(int id) {
        return movieDetailsMapper.getMovieReviewNumber(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "'id'+#id+'currPage'+#currPage+'number'+#number")
    public IPage<MovieCommon> getMovieReview(Page<MovieCommon> page,int id) {
        return movieDetailsMapper.getMovieReview(page,id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public List<MoviePerson> getMoviePersonDirector(int id) {
        return movieDetailsMapper.getMoviePersonDirector(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public List<MoviePerson> getMoviePersonActor(int id) {
        return movieDetailsMapper.getMoviePersonActor(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public List<String> getMoviePhoto(int id) {
        return movieDetailsMapper.getMoviePhoto(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public String getCastPhotoAuctor(int id) {
        return movieDetailsMapper.getCastPhotoAuctor(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public String getCastPhotoDirector(int id) {
        return movieDetailsMapper.getCastPhotoDirector(id);
    }

    @Override
    public IPage<CinemaMessage> getCinemaMessage(Page<CinemaMessage> page, String cinemaName, String region, String showTime,  String service) {
        return movieDetailsMapper.getCinemaMessage(page,cinemaName,region,showTime,service);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#id")
    public CinemaInformention getCinemaMessagePicture(int id) {
        return movieDetailsMapper.getCinemaMessagePicture(id);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "'id'+#id+'nowTime'+#nowTime")
    public List<MovieInformention> getCinemaMovie(int id,String nowTime) {
        return movieDetailsMapper.getCinemaMovie(id,nowTime);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "#perId")
    public TPerid selectTperidById(int perId) {
        return movieDetailsMapper.selectTperidById(perId);
    }

    @Override
    //@Cacheable(cacheNames = USER_CACHE_NAME,key = "'id'+#id+'demo'+#nowTime")
    public TDiscount getDiscountById(int id,String nowTime) {
        return movieDetailsMapper.getDiscountById(id,nowTime);
    }

    @Override
    public IPage<MovieShow> getMovieByMovieName(Page<MovieShow> page, String movieName) {
        return movieDetailsMapper.getMovieByMovieName(page,movieName);
    }

    @Override
    public IPage<PeopleShow> getMovieByPeopleName(Page<PeopleShow> page, String peopleName) {
        return movieDetailsMapper.getMovieByPeopleName(page,peopleName);
    }

    @Override
    public IPage<CinemaShow> getMovieByCinemaName(Page<CinemaShow> page, String cinemaName) {
        return movieDetailsMapper.getMovieByCinemaName(page,cinemaName);
    }

    @Override
    public IPage<MovieShow> getMovieByTypeTime(Page<MovieShow> page, String movieType, String movieTime) {
        return movieDetailsMapper.getMovieByTypeTime(page,movieType,movieTime);
    }

    @Override
    public IPage<DiscountShow> getDiscountByUserTel(Page<DiscountShow> page, String tel,String nowTime) {
        return movieDetailsMapper.getDiscountByUserTel(page,tel,nowTime);
    }

    @Override
    public List<String> getAllActorByMovieId(int id) {
        return movieDetailsMapper.getAllActorByMovieId(id);
    }

    @Override
    public List<String> getAllPhotoActorsByName(String name) {
        return movieDetailsMapper.getAllPhotoActorsByName(name);
    }

    @Override
    public List<String> getAllDirectorByMovieId(int id) {
        return movieDetailsMapper.getAllDirectorByMovieId(id);
    }

    @Override
    public List<String> getAllPhotoDirectorByName(String name) {
        return movieDetailsMapper.getAllPhotoActorsByName(name);
    }

    @Override
    public int getUserIdByUserTel(String userTel) {
        return movieDetailsMapper.getUserIdByUserTel(userTel);
    }

    @Override
    public OrderMessage getMovieIdByPerId(int perId) {
        return movieDetailsMapper.getMovieIdByPerId(perId);
    }

    @Override
    public void addOrderMessage(OrderMessage orderMessage) {
        movieDetailsMapper.addOrderMessage(orderMessage);
    }

    @Override
    public void changeDiscountState(int i) {
        movieDetailsMapper.changeDiscountState(i);
    }

    @Override
    public TVip getTvip(int userId, int cinemaId, String format) {
        return movieDetailsMapper.getTvip(userId,cinemaId,format);
    }

    @Override
    public void addOrderTicket(int str, String seat, String format) {
        movieDetailsMapper.addOrderTicket(str,seat,format);
    }

    @Override
    public void updateTradeNuo(String tradeNuo,int id) {
        movieDetailsMapper.updateTradeNuo(tradeNuo,id);
    }

    @Override
    public void zuofeiOrderMovie(int id) {
        movieDetailsMapper.zuofeiOrderMovie(id);
    }

    @Override
    public void zuofeiOrderTicket(int id) {
        movieDetailsMapper.zuofeiOrderTicket(id);
    }


    @Override
    public String getSetsByPerid(int peridId) {
        return movieDetailsMapper.getSetsByPerid(peridId);
    }

    @Override
    public void changeSeatStram(String s,int perId) {
        movieDetailsMapper.changeSeatStram(s,perId);
    }

    @Override
    public TOrderMovie getOrderMovie(int id) {
        return movieDetailsMapper.getOrderMovie(id);
    }
}
